<?php
if ( !defined( "IN_UCHOME" ) ) exit( "Access Denied" );
if($_POST['myFormAc'] == 'update'){
	$data['eventtype'] = format_array('eventtype');
	$data['price_type'] = format_array('price_type');
	$config = var_export($data, true);
	$config = "<?php\n\$action_config = " . $config . ";\n?>";
	swritefile('data/action_config.php', $config);
	showmessage("数据提交成功", "action.php?ac=admin", 3);
}else{
	$temp['eventtype'] = implode("\n", $action_config['eventtype']);
	$temp['price_type'] = implode("\n", $action_config['price_type']);
}
include_once( template( "action/view/admin" ) );

function format_array($type)
{
	$temp = array();
	$data = explode("\n", $_POST[$type]);
	foreach($data as $val){
		if(trim($val)) $temp[] = trim($val);
	}
	return $temp;
}
?>